package com.irdstudio.efp.nls.service.common.rules;

import com.irdstudio.basic.framework.core.constant.EsbRetCodeStandard;
import com.irdstudio.basic.framework.core.exception.BizException;
import com.irdstudio.efp.console.common.ConsoleConstant;
import com.irdstudio.efp.limit.service.vo.LmtPrdContVO;
import com.irdstudio.efp.nls.service.common.rules.CheckRule;

import java.util.Objects;

/**
 * 需求编号:2019D08--
 * 问题编号:
 * 开发人员: caoxin
 * 创建日期:2019/12/4
 * 功能描述:
 * 修改日期:2019/12/4
 * 修改描述:
 */
public class ValidateLmtPrdContRule implements CheckRule {
    private LmtPrdContVO lmtPrdContVO;

    public ValidateLmtPrdContRule(LmtPrdContVO lmtPrdContVO) {
        this.lmtPrdContVO = lmtPrdContVO;
    }

    @Override
    public void check() throws BizException {
        if (Objects.isNull(lmtPrdContVO) || !ConsoleConstant.LIMIT_STS_02.equals(lmtPrdContVO.getLmtStatus())) {
            throw new BizException(EsbRetCodeStandard.WFJKYWGZ.getValue(), "获取的授信协议信息为空或者获取到的授信协议不为已生效！");
        }
    }
}
